package com.sc.web.gwt.client.view.AdministratorWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.sc.web.gwt.client.GetTokenKeyService;
import com.sc.web.gwt.client.GetTokenKeyServiceAsync;

public class AdministratorWidgetViewImpl extends Composite implements AdministratorWidgetView {
    private static Binder binder = GWT.create(Binder.class);

    public interface Binder extends UiBinder<HTMLPanel, AdministratorWidgetViewImpl> {
    }

    private Presenter presenter;    

    @UiField
    Label tokenKey;

    @UiField
    Button genButton;

    public AdministratorWidgetViewImpl() {
        initWidget(binder.createAndBindUi(this));        
    }

    public void setPresenter(Presenter presenter) {
        this.presenter = presenter;
    }

    public void setTokenLabel(String text) {
        tokenKey.setText(text);
    }

    @UiHandler("genButton")
    public void genButtonClickHandler(ClickEvent event) {
        presenter.generateCode();
    }
}
